package com.jiazhong.project.mapper;

import com.jiazhong.project.pojo.Brand; // 统一使用 project.pojo 包
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface BrandMapper {
    @Select("select * from tb_brand")
    @ResultMap("brandResultMap")
    List<Brand> selectAll();

    @Insert("insert into tb_brand values (null,#{brandName}, #{companyName}, #{ordered}, #{description}, #{status})")
    int insertAll(Brand brand); // 移除包名前缀，保持简洁

    @Select("select * from tb_brand where id=#{id}")
    @ResultMap("brandResultMap")
    Brand selectByIdBrand(int id);

    @Update("update tb_brand set brand_name=#{brandName},company_name=#{companyName}, ordered=#{ordered}, description=#{description},status=#{status} where id=#{id}")
    void updateById(Brand brand);

    @Delete("delete from tb_brand where id=#{id}")
    void delById(int id);
}
